import './assets/css/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import service from './utils/service'
import ElementPlus from 'element-plus'
import { getWeb3 } from './utils/web3'
import 'element-plus/dist/index.css'

import App from './App.vue'
import router from './router'

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(ElementPlus)

app.config.globalProperties.$axios = service
router.afterEach((to) => {  // 一定要再afterEach中判断而不是beforeEach，因为beforeEach在点击返回之后获取到的值不准确，每返回一次，会获取到延后一次的to、history
    if (window.history.state && window.history.state.forward) { // 或者判断 to.forward,window.history.state.forward是vue-router写入的，当返回或前进的时候才会有值
        to.meta.isBack = true;
    } else {
        to.meta.isBack = false;
    }
});

getWeb3()

app.mount('#app')






